<%= render :partial => 'rep', :locals => { :dates => @dates } %>
<div>
    <h2>Kino - <%= @kina %></h2>

    <% for sum in @summary do %>    
        <%= sum %><br />
    <% end %>
    <p>
    <hr />
    Wygenerowane w <%= @gen_time.to_s %> sek. <%= @use_cache ? "(cached)" : "(non-cached)" %>
    <hr />
    <small>
    <% for rep in @reps do %>
        <% tytul = rep.ID_film.blank? || rep.film.nil? ? "" : rep.film.tytul %>
        <% godzina = rep.Godzina.kind_of?(Time) ? rep.Godzina.strftime('%H:%M') : "error: (rep.inspect)" %>
        <%= "#{rep.kino.nazwa}: <b>#{rep.Data}</b> - #{godzina} \"#{tytul}\" - " -%>
        <% if rep.errors.empty? %>
            OK
        <% else
               error = rep.errors.full_messages.join(', ') 
               if rep.ID_film.nil?
                   film = error[error.index('"')+1...error.rindex('"')] 
                   obce_id = error[error.index('#')+1...error.length]
               end
        %>
          <b><%= "#{error}"  -%></b> 
          <%= link_to "add to db", {:controller => 'admin', :action => 'add_foreign_film', :film => URI.escape(film), :kino => rep.ID_kino, :obce_id => URI.escape(obce_id)} , :popup => ['Foreign_film', 'height=200,width=600'] if rep.ID_film.nil? %>
        <% end %>
        <br />
    <% end %>
    </small>
    </p>
    <p align="center">
        <%= link_to "<- back", { :controller => 'admin', :action => 'rep'} %>
        <a href="#" onclick="document.location.reload(); return false;">redo -></a>
    </p>
</div>
